﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Agile.Paypal.Web
{
    public static class Utilities
    {
        public static T Try<T>(Func<T> func)
        {
            try
            {
                return func();
            }
            catch
            {
                return default(T);
            }
        }

        public static T Try<T, TArg1>(Func<TArg1, T> func, TArg1 arg1)
        {
            try
            {
                return func(arg1);
            }
            catch
            {
                return default(T);
            }
        }

        public static T Try<T, TArg1, TArg2>(Func<TArg1, TArg2, T> func, TArg1 arg1, TArg2 arg2)
        {
            try
            {
                return func(arg1, arg2);
            }
            catch
            {
                return default(T);
            }
        }

    }
}
